package com.aat.dxfy.htmlunit;

import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlPage;

public class Test01 {

	// http://www.cnblogs.com/cation/p/3933408.html

	public static void main(String[] args) throws Exception {
		// 创建一个
		WebClient wc = new WebClient();
		wc.getOptions().setJavaScriptEnabled(true);
		wc.getOptions().setCssEnabled(true);
		HtmlPage page = wc.getPage("http://www.dizena.com");
		String t = page.getTitleText();
		System.out.println("title:" + t);
		// 获取xml
		String sxml = page.asXml();
		System.out.println("xml:" + sxml);
		// 获取text
		String stext = page.asText();
		System.out.println("text:" + stext);
		wc.close();

	}

}